﻿<?php 
	$tmp = function_exists('gd_info') ? gd_info() : array();
	$host = (empty($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_HOST"] : $_SERVER["SERVER_ADDR"]);
	$allow_reference = (ini_get('allow_call_time_pass_reference') ? '<font color=green>[√]On</font>' : '<font color=red>[×]Off</font>');
	$allow_url_fopen = (ini_get('allow_url_fopen') ? '<font color=green>[√]On</font>' : '<font color=red>[×]Off</font>');
	$safe_mode = (ini_get('safe_mode') ? '<font color=red>[×]On</font>' : '<font color=green>[√]Off</font>');
	$err = 0;
	if (empty($tmp['GD Version'])) {
		$gd = '<font color=red>[×]Off</font>';
		$err++;
	} else {
		$gd = '<font color=green>[√]On</font> ' . $tmp['GD Version'];
	}
	if (function_exists('mysql_connect')) {
		$mysql = '<font color=green>[√]On</font>';
	} else {
		$mysql = '<font color=red>[×]Off</font>';
		$err++;
	}
	if (ini_get('file_uploads')) {
		$uploadSize = '<font color=green>[√]On</font> 文件限制:' . ini_get('upload_max_filesize');
	} else {
		$uploadSize = '禁止上传';
	}
	if (function_exists('session_start')) {
		$session = '<font color=green>[√]On</font>';
	} else {
		$session = '<font color=red>[×]Off</font>';
		$err++;
	}
	if (function_exists('curl_init')) {
		$curl_init = '<font color=green>[√]On</font>';
	} else {
		$curl_init = '<font color=red>[×]Off</font> 建议开启，关闭系统将不能获取到最新更新信息。';
	}
	$folder = array(
		'/',
		'admin',
		'include',
		'install',
		'images',
		'upload',
		'm',
	);
?>

<!DOCTYPE html>
<html>
    <head>
        <title>东丘管理系统安装向导</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="./js/jquery.min.js" language="javascript" type="text/javascript"></script>
        <script src="./js/jquery.form.js" language="javascript" type="text/javascript"></script>
        <script src="./js/jquery.validate.js" language="javascript" type="text/javascript"></script>
        <link href="./css/style.css" rel="stylesheet" type="text/css" />
		
		<script language="javascript" type="text/javascript">
			$(document).ready(function(){
				$("input[type='text']").addClass("input_blur").mouseover(function(){ $(this).addClass("input_focus");}).mouseout(function(){$(this).removeClass("input_focus");});
				$(".table tr").mouseover(function(){ $(this).addClass("mouseover");}).mouseout(function(){$(this).removeClass("mouseover");	});
			});
		</script>
    </head>
    <body>
        <div class="main">
            <h5>欢迎使用东丘管理系统</h5>

            <div class="title">
				<ul>
                    <?php  foreach($steps as $key=>$res){ ?>
                    <li <?php if($step==$key):?> class="on"<?php endif;?> ><?php echo $res?></li>
                    <?php } ?>
                </ul>
			</div>

            <div class="box">
				<div class="b1">
					<div class="right">

						<h1>服务器信息</h1>	
						<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
							<tr>
								<th width="300" align="left"><strong>参数</strong></th>
								<th width="424" align="left"><strong>值</strong></th>
							</tr>
							<tr>
								<td><strong>服务器域名/IP地址</strong></td>
								<td><?php echo ($_SERVER["SERVER_NAME"] . '/' .$host ); ?></td>
							</tr>
							<tr>
								<td><strong>服务器操作系统</strong></td>
								<td><?php echo (PHP_OS); ?></td>
							</tr>
							<tr>
								<td><strong>服务器解译引擎</strong></td>
								<td><?php echo ($_SERVER["SERVER_SOFTWARE"]); ?></td>
							</tr>
							<tr>
								<td><strong>PHP版本</strong></td>
								<td><?php echo (PHP_VERSION); ?></td>
							</tr>
							<tr>
								<td><strong>脚本超时时间</strong></td>
								<td><?php echo (ini_get('max_execution_time')); ?> 秒</td>
							</tr>

						</table>
						<h1>系统环境要求</h1> 

						<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="table">
							<tr>
								<th width="230"><strong>需开启的变量或函数</strong></th>
								<th width="100"><strong>系统要求</strong></th>
								<th width="400"><strong>实际状态及建议</strong></th>
							</tr>
							<tr>
								<td>GD 支持 </td>
								<td>支持</td>
								<td><?php echo $gd; ?></td>
							</tr>
							<tr>
								<td>MySQL 支持</td>
								<td>支持</td>
								<td><?php echo $mysql; ?></td>
							</tr>
							<tr> 
								<td>upload</td>
								<td>支持</td>
								<td><?php echo $uploadSize ?></td>
							</tr>
							<tr>
								<td>session</td>
								<td>支持</td>
								<td><?php echo $session ?></td>
							</tr>
							<tr>
								<td>curl 支持</td>
								<td>支持</td>
								<td><?php echo $curl_init ?></td>
							</tr>
						</table>
						<h1>目录权限检测</h1> 
						<div style="margin:10px auto; color:#666;">
							系统要求必须满足下列所有的目录权限全部可读写的需求才能使用。
						</div>

						<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
							<tr>
								<th width="230"><strong>目录名</strong></th>
								<th width="100"><strong>系统要求</strong></th>
								<th width="400"><strong>实际状态及建议</strong></th>
							</tr>
							<?php
								foreach($folder as $dir)
								{
									$tmpdir = ROOT_PATH.$dir;
									dir_create($tmpdir);
									if($install->check_dirwrite($tmpdir))
									{
										$w = '<font color=green>[√]写</font>';
									}
									else
									{
										$w = '<font color=red>[×]写</font>';
										$err++;
									}
									if(is_readable($tmpdir))
									{
										$r = '<font color=green>[√]读</font>' ;
									}
									else
									{
										$r = '<font color=red>[×]读</font>';
										$err++;
									}
							?>
							<tr>
								<td><?php echo $dir; ?></td>
								<td>读写</td>
								<td><?php echo $r." ".$w; ?></td>
							</tr>
							<?php } ?>
						</table>


						<div class="butbox">
							<input type="button" class="inputButton" value=" 上一步 " onclick="history.back();" style="margin-right:20px" />		
							<input type="button" class="inputButton" value=" 下一步 " onclick="window.location.href='index.php?step=3';" <?php if($err>0){ ?> id="nonext"  disabled<?php } ?>  />	
								   <input type="button" class="inputButton" value=" 重新检测 " onclick="document.location.reload();" style="margin-left:20px" />
						</div>
					</div>
				</div>
				<div class="power">Powered by <a href="#" target="_blank">大连东丘贸易有限公司</a> 
				</div>
			</div>
		</div>
	</body>
</html>